<!DOCTYPE html>
<html layout:decorate="admin/layout" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>作品管理</title>
  <style>
    .layui-table tbody tr td .layui-table-cell{
      height: auto;
    }

    .layui-table img{
      max-width: 160px;
    }
  </style>
</head>
<body>
<div layout:fragment="content">

  <div style="padding: 20px;">
    <form class="layui-form" lay-filter="searchform" onsubmit="return false">
      <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label" style="width: 100px;">作品名称/DCI码</label>
          <div class="layui-input-inline">
            <input type="text" name="worksNameOrDciCode" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">作品分类</label>
          <div class="layui-input-inline">
            <select id="category_select" name="categoryId" lay-verify="">
              <option value="">全部</option>
            </select>
          </div>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">状态</label>
          <div class="layui-input-inline">
            <select id="process_select" name="worksProcessDetail" lay-verify="">
              <option value="">全部</option>
            </select>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label" style="width: 100px;">申请人</label>
          <div class="layui-input-inline">
            <input name="createor" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">申请日期</label>
          <div class="layui-input-inline">
            <input type="text" class="layui-input" id="createTime">
            <input type="hidden" class="layui-input" name="startDate">
            <input type="hidden" class="layui-input" name="endDate">
          </div>
        </div>
        <div class="layui-inline">
          <a id="btn-query" class="layui-btn" style="margin-left: 80px;">查询</a>
          <a id="btn-pass" class="layui-btn">批量通过</a>
          <a id="btn-refuse" class="layui-btn">批量拒绝</a>
        </div>
      </div>
    </form>
    <table lay-data="{url:'/admin/works/page', where:{isAdmin:1,authorizeRule:'SeniorPartnerAuthorize'},page:true, id:'worksTable',request:{pageName: 'page',limitName: 'size'}}" class="layui-table"
            lay-filter="worksFilter">
      <thead>
      <tr>
        <th lay-data="{type:'checkbox'}"></th>
        <th lay-data="{width:200,align:'center',toolbar: '#imgColunm'}">作品样图</th>
        <th lay-data="{align:'center',toolbar: '#infoColunm',field:'score',sort:true}">作品信息</th>
        <th lay-data="{width:80,align:'center',field:'createor'}">申请人</th>
        <th lay-data="{width:180,align:'center',field:'createTime',sort:true}" >创建时间</th>
        <th lay-data="{width:180,align:'center',field:'modifyTime',sort:true}">修改时间</th>
        <th lay-data="{width:120,align:'center',field:'worksProcessDetailDesc'}">状态</th>
        <th lay-data="{width:120,align:'center',title:'操作', toolbar: '#operateColunm'}">操作</th>
      </tr>
      </thead>
    </table>
  </div>

  <div id="refuseReason" class="layui-main" style="display: none;">
    <div class="layui-form">
      <p align="center" style="margin: 30px auto;" class="layui-text">拒绝原因</p>
      <div class="layui-form-item layui-form-text">
          <textarea placeholder="请输入拒绝原因" class="layui-textarea"></textarea>
      </div>
    </div>
  </div>
</div>
<th:block layout:fragment="script">
  <script type="text/html" id="imgColunm">
    <img src="{{d.imageUrl}}">
    <p>{{d.worksFullName}}</p>
    {{#  if(d.worksProcess == 'passed'){ }}
    <p> {{ d.dciCode }}</p>
    {{# } }}
  </script>
  <script type="text/html" id="infoColunm">
    <p style="float: left;clear: both;"> 作品类型：{{d.worksTypeName}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 分类：{{d.workCategroyName}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="checkbox" title="其他作品" lay-filter="otherProduct" value="{{d.id}}"></p>
    <p style="float: left;clear: both;"> 创作说明：{{d.mainFeatures}}</p>
    <p style="float: left;clear: both;"> 评&nbsp;&nbsp;&nbsp;&nbsp;分： <input name="score" value="{{d.score}}" style="width:80px;height: 25px;" data-id="{{d.id}}" /> &nbsp;&nbsp; 用途：<select name="users"  lay-ignore style="height: 25px" ><option value="1"  >商业用途</option>{{#  if(d.uses==2){ }} <option value="2" selected="selected">仅限传媒用途</option>  {{#  } else { }}  <option value="2" >仅限传媒用途</option> {{#  } }}  </select></p>
    <P style="float: left;clear: both; padding-top: 5px;" ><label>关键字：</label> <textarea cols="40"  placeholder="关键词" id="keywords" data-id="{{d.id}}">{{d.keywords}} </textarea></P>
  </script>
  <script type="text/html" id="operateColunm">
    <a class="layui-btn layui-btn-sm" lay-event="detail" >查看</a> <br>
    {{#  if(d.isOnSale == 1){ }}
    <a class="layui-btn layui-btn-sm" style="margin-top: 5px;" lay-event="off" >下架</a> <br>
    {{# } }}

    {{#  if(d.worksProcessDetail == 'commited'){ }}
    <a class="layui-btn layui-btn-sm layui-btn-warm" style="margin-top: 5px;" lay-event="pass">通过</a> <br>
    <a class="layui-btn layui-btn-sm layui-btn-danger" style="margin-top: 5px;" lay-event="refuse">拒绝</a>
    {{# } }}
  </script>
  <script type="text/javascript">
    layui.use('works'); //加载入口
  </script>
</th:block>
</body>
</html>